package cn.edu.zafu.bigdata.x.wgj.c;

import java.util.*;
class Pentagon extends Shape{
    void draw(){
        System.out.println("Calling Pentagon.draw()");
    }
    void erase(){
        System.out.println("Calling Pentagon.erase()");
    }
}
public class Shapes_2 {
    static void drawShapes(Shape[] ss){
        for(int i =0;i<ss.length;i++){
            ss[i].draw();
        }
    }
    public static void main(String[] args){
        Random rand=new Random();
        Shape[] s=new Shape[9];
        for(int i=0;i<s.length;i++){
            switch (rand.nextInt(4)){
                case 0:s[i]=new Circle();break;
                case 1:s[i]=new Square();break;
                case 2:s[i]=new Triangle();break;
                case 3:s[i]=new Pentagon();break;
            }
        }
        drawShapes(s);
    }
}
